if which is in "about...,New,open...,Save,save as...,revert,print...," & "print code...,show all code,Show code of a line...,Home,add," & "insert,Edit,replace,delete,label above command" then
lock screen
if which is "About..." then
set cursor to watch
go cd "about"
unlock screen with iris open
hide menubar
exit domenu
end if
if which is "open..." then
go cd 1
if check_empty() is true then exit domenu
open_a_file
exit domenu
end if
if which is "new" then
set lockMessages to true
go cd 1
if check_empty() is true then exit domenu
put empty into cd field "survey"
set the scroll of cd field "survey" to 0
put "Untitled" into line 1 of cd field "file"
set the width of cd field "file" to 74
set the visible of cd btn "commands" to true
go cd "survey file"
put "" into cd field "survey file"
set the scroll of cd field "survey file" to 0
go cd 1
clearHiliteBtn
exit domenu
end if
if which is "save" then
set lockMessages to true
if line 1 of cd field "file" = "Untitled" then
get save_survey()
else
go cd 1
put line 2 of cd field "file" into fichier
go cd "survey file"
WriteToFile cd field "survey file",true,fichier,false,"MACA"
go cd 1
end if
exit domenu
end if
if which is "save as..." then
get save_survey()
exit domenu
end if
if which is "revert" then
answer "Revert to the last saved version?" with "Yes" or "Cancel"
if it is "cancel" then exit domenu
go cd 1
open_a_file (line 2 of cd field "file")
exit domenu
end if
if which is "print..." then
go cd 1
printField "cd field id 1",2,0,0,0,0
exit domenu
end if
if which is "print code..." then
go cd "survey file"
printField "cd field id 3",2,36,36,36,36
go cd 1
exit domenu
end if
if which is "show all code" then
go cd "survey file"
set the scroll of cd field "survey file" to 0
exit domenu
end if
if which is "label above command" then
unlock screen
set the hilite of btn which to not the hilite of btn which
label_above
set the scroll of cd field "survey" to 0
exit domenu
end if
if which is "home" then
go home
exit domenu
end if
if cd field id 99 is empty and which ≠ "add" then
answer "You must select a line first."
exit domenu
end if
if which is "show code of a line..." then
put "Please, click on a line to show it's code or click here to cancel." into cd field "header"
unlock screen
Edit_a_line false
exit domenu
end if
put which into line 1 of cd field "action"
put which into line 3 of cd field "action"
if which is "Edit" then
put "Please, click on the line to Edit or click here to cancel." into cd field "header"
unlock screen
Edit_a_line true
exit domenu
end if
if which is "delete" then
delete_a_line
exit domenu
end if
show cd field "Header"
put "Action selected was “" & which & "”. Click on a line or click here to cancel." into cd field "header"
show cd field "commandLIST"
show cd field "command # list"
show cd field "command number"
show cd field "label command number"
unlock screen
put "" into cd field "command number"
click at the loc of cd field "command number"
else
pass domenu
end if
end domenu
on open_a_file fichier
set lockMessages to true
if fichier = "" then
put fileName("TEXT","Select your Survey file...") into fichier
if fichier is empty then exit open_a_file
go cd 1
put fichier into line 2 of cd field "file"
end if
clearHiliteBtn
show cd field "wait"
unlock screen
lock screen
set the hilite of cd btn "Label above command" to false